﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Copad.BusinessCard.Model;

namespace Copad.BusinessCard.BLL
{
    public class ModelsBLL
    {
        static CategoryBLL categoryBLL = new CategoryBLL();

        public static List<Model.Models> GetFirstDirectory(UserInfo userInfo, long id)
        {
            List<Models> list = new List<Models>();
            switch (id)
            {
                case 0:
                    list.Add(new Models { ID = 1, ModelName = "我的收藏", PageDirection = "Favorite.aspx" });
                    list.Add(new Models { ID = 2, ModelName = "名片管理", PageDirection = "CardList.aspx" });
                    if (userInfo.Groups.Where(x => x.Name == "系统管理员").FirstOrDefault() != null)
                    {
                        list.Add(new Models { ID = 3, ModelName = "用户管理", PageDirection = "UserList.aspx" });
                        list.Add(new Models { ID = 4, ModelName = "权限管理", PageDirection = "Permissions.aspx" });
                        list.Add(new Models { ID = 5, ModelName = "系统设置", PageDirection = "SystemConfig.aspx" });
                    }
                    break;
                case 1:
                    list.Add(new Models { ID = 0, ModelName = "我收藏的名片", PageDirection = "CardList.aspx?mode=favorite" });
                    break;
                case 2:
                    var categories = categoryBLL.GetStatisticks(userInfo);
                    categories.ForEach(x =>
                    {

                        list.Add(new Models { ID = 0, ModelName = x.Name, PageDirection = "CardList.aspx?id=" + x.ID, TagData = x.Count });
                    });
                    break;
                case 3:
                    list.Add(new Models { ID = 1, ModelName = "用户列表", PageDirection = "UserList.aspx" });
                    list.Add(new Models { ID = 0, ModelName = "分组列表", PageDirection = "GroupList.aspx" });
                    break;
                case 4:
                    //list.Add(new Models { ID = 1, ModelName = "名片访问权限", PageDirection = "CardListPermissions.aspx" });
                    list.Add(new Models { ID = 0, ModelName = "名片分类访问权限", PageDirection = "CategoryPermissions.aspx" });
                    //list.Add(new Models { ID = 0, ModelName = "功能访问权限", PageDirection = "UserPermissions.aspx" });
                    break;
                case 5:
                    list.Add(new Models { ID = 0, ModelName = "系统配置", PageDirection = "SystemConfig.aspx" });
                    list.Add(new Models { ID = 1, ModelName = "数据同步", PageDirection = "Sync.aspx" });
                    list.Add(new Models { ID = 1, ModelName = "日志管理", PageDirection = "LogList.aspx" });
                    break;
            }
            return list;
        }

        public static List<Models> GetShortCutModel(List<SubModels> list)
        {
            List<Models> listModels = new List<Models>();
            listModels.Add(new Models { ID = 0, Functionids = 0, ModelName = "我收藏的名片", PageDirection = "CardList.aspx?mode=favorite" });
            //listModels.Add(new Models { ID = 1, Functionids = 0, ModelName = "名片列表", PageDirection = "CardList.aspx" });
            return listModels;
        }
    }
}
